<template>
  <div class="Wardinformation">
    <div class="pubBig standard ">
      <div class="h0">
        <p class="lt">临床远程会诊</p>
      </div>

      <div class="dRightMain">
        <el-tabs
          v-model="activeName"
          @tab-click="handleClick"
        >
          <el-tab-pane
            label="会诊信息"
            name="first"
          >
            <div
              style="height: 500px;overflow: auto"
              class="cardP"
            >
              <el-card class="box-card">
                <div
                  slot="header"
                  class="clearfix"
                >
                  <span>会诊基本信息</span>
                  <el-button
                    style="float: right; padding: 3px 0"
                    type="text"
                    v-if="false"
                  >操作按钮
                  </el-button>
                </div>
                <div>
                  <el-row>
                    <el-col :span="6">
                      <div class="grid-content bg-purple div_P">
                        <div class=" form-group ">
                          <p>
                            <label>会诊方式：</label>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult.ConType"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in hzfsList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple-light div_P">
                        <div class="form-group">
                          <p>
                            <label>急诊情况：</label>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult.isEm"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in jjqkList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple div_P">
                        <div class="form-group">
                          <p>
                            <label>申请类型：</label>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult.ReqType"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in sqlxList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple-light div_P">
                        <div class="form-group">
                          <p>
                            <label>是否交互式：</label>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult.isAc"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in sfjhList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                  </el-row>
                </div>
              </el-card>
              <el-card class="box-card">
                <div
                  slot="header"
                  class="clearfix"
                >
                  <span>会诊方信息</span>
                </div>
                <div>
                  <el-row>
                    <el-col :span="12">
                      <div class="grid-content bg-purple div_P">
                        <div class=" form-group ">
                          <p class="selectTime">
                            <label>期望会诊日期：</label>
                            <el-date-picker
                              style="width:12rem;height:32px"
                              type="date"
                              value-format="yyyy-MM-dd"
                              v-model="huizhenObj.Consult.SubscribeTime"
                              placeholder="选择日期"
                            >
                            </el-date-picker>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult.TimeFlag"
                              placeholder="请选择"
                              style=""
                            >
                              <option
                                v-for="(item,index) in hzsjList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>

                        </div>
                      </div>
                    </el-col>
                    <el-col :span="12">
                      <div class="grid-content bg-purple-light div_P">
                        <button
                          class="btn btn-default"
                          @click="showDialog('YSLB')"
                        >添加会诊医生
                        </button>
                      </div>
                    </el-col>

                  </el-row>
                </div>
                <div class="fjtable">
                  <el-table
                    :data="huizhenObj.Consult_Joins"
                    height="112"
                    border
                    style="width: 100%"
                  >
                    <el-table-column
                      fixed
                      prop="HospitalId"
                      label="所属医院"
                    >
                    </el-table-column>
                    <el-table-column
                      prop="name"
                      label="科室"
                    >
                    </el-table-column>
                    <el-table-column
                      prop="UserName"
                      label="姓名"
                    >
                    </el-table-column>
                    <el-table-column
                      prop="Title"
                      label="擅长"
                    >
                    </el-table-column>
                    <el-table-column
                      prop="Describe"
                      label="简介"
                    >
                    </el-table-column>
                    <el-table-column
                      fixed="right"
                      label="是否主诊"
                      width="88"
                    >
                      <template slot-scope="scope">
                        <el-switch
                          v-model="scope.row.IsMaster==1"
                          active-color="#13ce66"
                          inactive-color="#ff4949"
                          @change="updateRow2YS(scope.$index, huizhenObj.Consult_Joins)"
                        >
                        </el-switch>

                      </template>
                    </el-table-column>
                    <el-table-column
                      fixed="right"
                      label="操作"
                      width="80"
                    >
                      <template slot-scope="scope">
                        <el-button
                          type="text"
                          size="small"
                          @click.native.prevent="deleteRow2YS(scope.$index, huizhenObj.Consult_Joins)"
                        >
                          删除
                        </el-button>
                      </template>
                    </el-table-column>
                  </el-table>
                </div>
              </el-card>
              <el-card class="box-card">
                <div
                  slot="header"
                  class="clearfix"
                >
                  <span>申请方信息</span>
                </div>
                <div>
                  <el-row>
                    <el-col :span="12">
                      <div class="grid-content bg-purple div_P">
                        <div v-if="false">
                          <p>
                            <label
                              style="padding-right: 120px;padding-right: 80px"
                            >填写方式：</label>
                            <template style="margin-left: 38px">
                              <el-radio
                                v-model="radio"
                                label="1"
                              >系统关联</el-radio>
                              <el-radio
                                v-model="radio"
                                label="2"
                              >手工录入</el-radio>
                            </template>
                          </p>

                        </div>
                      </div>
                    </el-col>
                    <el-col :span="12">

                    </el-col>

                  </el-row>
                  <div v-if="radio==2">
                    <el-row>
                      <el-col :span="6">
                        <div class="grid-content bg-purple div_P">
                          <div class=" form-group ">
                            <p>
                              <label>申请医院：</label>
                              <select
                                class="form-control"
                                v-model="model_clinic_typeC"
                                placeholder="请选择"
                              >
                                <option
                                  v-for="(item,index) in hzfsList"
                                  :label="item.name"
                                  :value="item.code"
                                  :key="index"
                                ></option>
                              </select>
                            </p>
                          </div>
                        </div>
                      </el-col>
                      <el-col :span="6">
                        <div class="grid-content bg-purple-light div_P">
                          <div class="form-group">
                            <p>
                              <label>申请科室：</label>
                              <select
                                class="form-control"
                                v-model="model_clinic_typeC"
                                placeholder="请选择"
                              >
                                <option
                                  v-for="(item,index) in jjqkList"
                                  :label="item.name"
                                  :value="item.code"
                                  :key="index"
                                ></option>
                              </select>
                            </p>
                          </div>
                        </div>
                      </el-col>
                      <el-col :span="6">
                        <div class="grid-content bg-purple div_P">
                          <div class="form-group">
                            <p>
                              <label>申请子科室：</label>
                              <select
                                class="form-control"
                                v-model="model_clinic_typeC"
                                placeholder="请选择"
                              >
                                <option
                                  v-for="(item,index) in sqlxList"
                                  :label="item.name"
                                  :value="item.code"
                                  :key="index"
                                ></option>
                              </select>
                            </p>
                          </div>
                        </div>
                      </el-col>
                      <el-col :span="6">
                        <div class="grid-content bg-purple-light div_P">
                          <div class="form-group">
                            <p>
                              <label>申请医生：</label>
                              <select
                                class="form-control"
                                v-model="model_clinic_typeC"
                                placeholder="请选择"
                              >
                                <option
                                  v-for="(item,index) in sfjhList"
                                  :label="item.name"
                                  :value="item.code"
                                  :key="index"
                                ></option>
                              </select>
                            </p>
                          </div>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                  <div v-if="radio==1">
                    <el-row>
                      <el-col :span="6">
                        <div class="grid-content bg-purple div_P">
                          <div class=" form-group ">
                            <p>
                              <label>申请医院：</label>
                              <input
                                type="text"
                                class="form-control"
                                disabled
                                v-model="LoginInfor.HospitalName"
                                placeholder="必填"
                              >
                              </input>
                            </p>
                          </div>
                        </div>
                      </el-col>
                      <el-col :span="6">
                        <div class="grid-content bg-purple-light div_P">
                          <div class="form-group">
                            <p>
                              <label>申请科室：</label>
                              <input
                                type="text"
                                class="form-control"
                                disabled
                                v-model="LoginInfor.DeptName"
                                placeholder="必填"
                              >
                              </input>
                            </p>
                          </div>
                        </div>
                      </el-col>

                      <el-col :span="6">
                        <div class="grid-content bg-purple-light div_P">
                          <div class="form-group">
                            <p>
                              <label>申请医生：</label>
                              <input
                                type="text"
                                class="form-control"
                                disabled
                                v-model="LoginInfor.UserName"
                                placeholder="必填"
                              >
                              </input>
                            </p>
                          </div>
                        </div>
                      </el-col>
                    </el-row>
                  </div>
                </div>
              </el-card>
            </div>
          </el-tab-pane>
          <el-tab-pane
            label="患者信息"
            name="second"
          >
            <div
              style="height: 500px;overflow: auto"
              class="cardP"
            >
              <el-card class="box-card">
                <div
                  slot="header"
                  class="clearfix"
                >
                  <span>患者信息</span>
                  <button
                    type="button"
                    class="btn btn-primary"
                    style="float: right; padding: 3px 12px"
                  >
                    导入
                  </button>
                </div>
                <div>
                  <el-row>
                    <el-col :span="6">
                      <div class="grid-content bg-purple div_P">
                        <div class=" form-group ">
                          <p>
                            <label>申请类型：</label>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.Catagory"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in sqlxList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple-light div_P">
                        <div class="form-group">
                          <p>
                            <label>患者姓名：</label>
                            <input
                              type="text"
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.Name"
                              placeholder="必填"
                            >
                            </input>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple div_P">
                        <div class="form-group">
                          <p class="selectTime">
                            <label>出生日期：</label>
                            <el-date-picker
                              style="width:12rem;height:32px"
                              type="date"
                              v-model="huizhenObj.Consult_Patient.Born"
                              value-format="yyyy-MM-dd "
                              placeholder="选择日期"
                            >
                            </el-date-picker>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple-light div_P">
                        <div class="form-group">
                          <p>
                            <label>年龄：</label>
                            <input
                              type="text"
                              class="form-control"
                              style="width: 6rem"
                              v-model="huizhenObj.Consult_Patient.Age"
                              placeholder="必填"
                            >
                            </input>
                            <select
                              class="form-control"
                              style="width: 6rem;margin-left: 20px"
                              v-model="huizhenObj.Consult_Patient.AgeUnit"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in nldwList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="6">
                      <div class="grid-content bg-purple div_P">
                        <div class=" form-group ">
                          <p>
                            <label>性别：</label>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.Sex"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in xbList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple-light div_P">
                        <div class="form-group">
                          <p>
                            <label>体重：</label>
                            <input
                              type="text"
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.Weight"
                              placeholder="必填"
                            >
                            </input>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple div_P">
                        <div class="form-group">
                          <p class="selectTime">
                            <label>身高：</label>
                            <input
                              type="text"
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.Height"
                              placeholder="必填"
                            >
                            </input>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple-light div_P">
                        <div class="form-group">
                          <p>
                            <label>BMI：</label>
                            <input
                              type="text"
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.BMI"
                              placeholder="必填"
                            >
                            </input>
                          </p>
                        </div>
                      </div>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="6">
                      <div class="grid-content bg-purple div_P">
                        <div class=" form-group ">
                          <p>
                            <label>婚姻情况：</label>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.Marital"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in hyqkList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple-light div_P">
                        <div class="form-group">
                          <p>
                            <label>患者病情：</label>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.Condition"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in hzbqList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple div_P">
                        <div class="form-group">
                          <p class="selectTime">
                            <label>入院时间：</label>
                            <el-date-picker
                              style="width:168px;height:32px"
                              type="date"
                              v-model="huizhenObj.Consult_Patient.InDate"
                              value-format="yyyy-MM-dd"
                              placeholder="选择日期"
                            >
                            </el-date-picker>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple-light div_P">
                        <div class="form-group">
                          <p>
                            <label>电话：</label>
                            <input
                              type="text"
                              class="form-control"
                              style="width: 180px"
                              v-model="huizhenObj.Consult_Patient.TelePhone"
                              placeholder="必填"
                            >
                            </input>
                          </p>
                        </div>
                      </div>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="6">
                      <div class="grid-content bg-purple div_P">
                        <div class=" form-group ">
                          <p>
                            <label>医保类别：</label>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.MedicalCatagory"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in yblbList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple-light div_P">
                        <div class="form-group">
                          <p>
                            <label>医保卡号：</label>
                            <input
                              type="text"
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.MedicalCard"
                              placeholder="必填"
                            >
                            </input>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple div_P">
                        <div class="form-group">
                          <p class="selectTime">
                            <label>就诊科室：</label>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.Dept"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in deptList"
                                :label="item.Name"
                                :value="item.Id"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple-light div_P">
                        <div class="form-group">
                          <p>
                            <label>就诊类型：</label>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.SeekCatagory"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in jzlxList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="6">
                      <div class="grid-content bg-purple div_P">
                        <div class=" form-group ">
                          <p>
                            <label>国籍：</label>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.Country"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in gjList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple-light div_P">
                        <div class="form-group">
                          <p>
                            <label>民族：</label>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.Nation"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in mzList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple div_P">
                        <div class="form-group">
                          <p class="selectTime">
                            <label>职业：</label>
                            <select
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.Occupation"
                              placeholder="请选择"
                            >
                              <option
                                v-for="(item,index) in zyList"
                                :label="item.name"
                                :value="item.code"
                                :key="index"
                              ></option>
                            </select>
                          </p>
                        </div>
                      </div>
                    </el-col>
                    <el-col :span="6">
                      <div class="grid-content bg-purple-light div_P">
                        <div class="form-group">
                          <p>
                            <label>地址：</label>
                            <input
                              type="text"
                              class="form-control"
                              v-model="huizhenObj.Consult_Patient.Address"
                              placeholder="必填"
                            >
                            </input>
                          </p>
                        </div>
                      </div>
                    </el-col>
                  </el-row>
                </div>
              </el-card>

            </div>
          </el-tab-pane>
          <el-tab-pane
            label="病历摘要"
            name="third"
          >
            <div class="cardP">
              <el-card class="box-card">
                <div
                  slot="header"
                  class="clearfix"
                >
                  <span>病历摘要</span>
                  <el-button
                    style="float: right; padding: 3px 0"
                    type="text"
                    v-if="false"
                  >操作按钮
                  </el-button>
                </div>
                <div
                  class="cardC"
                  style="height: 400px;overflow-y: auto"
                >
                  <el-row>
                    <el-col :span="12">
                      <div class="grid-content bg-purple ">
                        <el-card style="width: 100%">
                          <div
                            slot="header"
                            class="clearfix"
                          >
                            <span>患者主诉</span>
                          </div>
                          <div>
                            <el-input
                              type="textarea"
                              :rows="4"
                              placeholder="字数限制200"
                              maxlength="200"
                              show-word-limit
                              v-model="huizhenObj.Consult_Patient_Remark.ZhuSu"
                            >
                            </el-input>
                          </div>

                        </el-card>
                      </div>
                    </el-col>
                    <el-col :span="12">
                      <div class="grid-content bg-purple ">
                        <el-card style="width: 100%">
                          <div
                            slot="header"
                            class="clearfix"
                          >
                            <span>现病史</span>

                          </div>
                          <div>
                            <el-input
                              type="textarea"
                              :rows="4"
                              placeholder="字数限制200"
                              maxlength="200"
                              show-word-limit
                              v-model="huizhenObj.Consult_Patient_Remark.XianBingShi"
                            >
                            </el-input>
                          </div>

                        </el-card>
                      </div>
                    </el-col>

                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <div class="grid-content bg-purple ">
                        <el-card style="width: 100%">
                          <div
                            slot="header"
                            class="clearfix"
                          >
                            <span>既往史、个人史、家族史</span>
                          </div>
                          <div>
                            <el-input
                              type="textarea"
                              :rows="4"
                              placeholder="字数限制1000"
                              maxlength="1000"
                              show-word-limit
                              v-model="huizhenObj.Consult_Patient_Remark.JiWangShi"
                            >
                            </el-input>
                          </div>

                        </el-card>
                      </div>
                    </el-col>
                    <el-col :span="12">
                      <div class="grid-content bg-purple ">
                        <el-card style="width: 100%">
                          <div
                            slot="header"
                            class="clearfix"
                          >
                            <span>体格检查</span>

                          </div>
                          <div>
                            <el-input
                              type="textarea"
                              :rows="4"
                              placeholder="字数限制1000"
                              maxlength="1000"
                              show-word-limit
                              v-model="huizhenObj.Consult_Patient_Remark.TiGeJianCha"
                            >
                            </el-input>
                          </div>

                        </el-card>
                      </div>
                    </el-col>

                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <div class="grid-content bg-purple ">
                        <el-card style="width: 100%">
                          <div
                            slot="header"
                            class="clearfix"
                          >
                            <span>辅助检查结果</span>
                          </div>
                          <div>
                            <el-input
                              type="textarea"
                              :rows="4"
                              placeholder="字数限制1000"
                              maxlength="1000"
                              show-word-limit
                              v-model="huizhenObj.Consult_Patient_Remark.FuZhuJianCha"
                            >
                            </el-input>
                          </div>

                        </el-card>
                      </div>
                    </el-col>
                    <el-col :span="12">
                      <div class="grid-content bg-purple ">
                        <el-card style="width: 100%">
                          <div
                            slot="header"
                            class="clearfix"
                          >
                            <span>初步诊断</span>

                          </div>
                          <div>
                            <el-input
                              type="textarea"
                              :rows="4"
                              placeholder="字数限制1000"
                              maxlength="1000"
                              show-word-limit
                              v-model="huizhenObj.Consult_Patient_Remark.ChuBuZhenDuan"
                            >
                            </el-input>
                          </div>

                        </el-card>
                      </div>
                    </el-col>

                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <div class="grid-content bg-purple ">
                        <el-card style="width: 100%">
                          <div
                            slot="header"
                            class="clearfix"
                          >
                            <span>治疗经过</span>
                          </div>
                          <div>
                            <el-input
                              type="textarea"
                              :rows="4"
                              placeholder="字数限制1000"
                              maxlength="1000"
                              show-word-limit
                              v-model="huizhenObj.Consult_Patient_Remark.ZhiLiaoJingGuo"
                            >
                            </el-input>
                          </div>

                        </el-card>
                      </div>
                    </el-col>
                    <el-col :span="12">

                    </el-col>

                  </el-row>
                </div>
              </el-card>
            </div>
          </el-tab-pane>
          <el-tab-pane
            label="心电检查"
            name="fourth"
          >
            <div class="cardP">
              <el-card class="box-card">
                <div
                  slot="header"
                  class="clearfix"
                >
                  <span>检查检验</span>
                  <el-button
                    style="float: right; padding: 3px 0"
                    type="text"
                    v-if="false"
                  >操作按钮
                  </el-button>
                </div>
                <div
                  class="cardC"
                  style="height: 400px;overflow-y: auto"
                >
                  <el-row>
                    <el-col :span="24">
                      <div class="grid-content bg-purple ">
                        <el-card style="width: 100%">
                          <div
                            slot="header"
                            class="clearfix"
                          >
                            <span>心电检查</span>
                            <el-button
                              type="success"
                              style="float: right; padding: 3px 0"
                              @click="showDialog('XDLB')"
                            >上传
                              <i class="el-icon-upload el-icon--right"></i>
                            </el-button>
                          </div>
                          <div class="fjtable">
                            <el-table
                              :data="huizhenObj.Consult_ECGRecords"
                              height="112"
                              border
                              style="width: 100%"
                            >
                              <el-table-column
                                fixed
                                prop="StudyId"
                                label="检查编号"
                                width="120"
                              >
                              </el-table-column>
                              <el-table-column
                                fixed
                                prop="Device"
                                label="检查设备"
                                width="120"
                              >
                              </el-table-column>
                              <el-table-column
                                fixed
                                prop="Modality"
                                label="检查类别"
                                width="120"
                              >
                              </el-table-column>
                              <el-table-column
                                prop="CheckTime"
                                label="检查时间"
                                width="120"
                              >
                              </el-table-column>
                              <el-table-column
                                prop="StudyDesc"
                                label="检查说明"
                              >
                              </el-table-column>
                              <el-table-column
                                fixed="right"
                                label="操作"
                                width="100"
                              >
                                <template slot-scope="scope">
                                  <el-button
                                    @click="handleClickXDItem(scope.row)"
                                    type="text"
                                    size="small"
                                  >查看
                                  </el-button>
                                  <el-button
                                    type="text"
                                    size="small"
                                    @click.native.prevent="deleteRow2XD(scope.$index, huizhenObj.Consult_ECGRecords)"
                                  >
                                    删除
                                  </el-button>
                                </template>
                              </el-table-column>
                            </el-table>
                          </div>
                        </el-card>
                      </div>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <div class="grid-content bg-purple ">
                        <el-card style="width: 100%">
                          <div
                            slot="header"
                            class="clearfix"
                          >
                            <span>相关附件</span>
                            <el-button
                              type="success"
                              style="float: right; padding: 3px 0"
                              @click="showDialog('PZ')"
                            >
                              拍照
                              <i class="el-icon-upload el-icon--right"></i>
                            </el-button>
                          </div>
                          <div class="fjtable selectPic">
                            <el-upload
                              ref='upload'
                              :auto-upload='false'
                              :file-list="fileList"
                              :multiple='false'
                              :limit="12"
                              :on-exceed="handleExceed"
                              :http-request="uploadFiles"
                              accept="image/jpeg,image/gif,image/png"
                              action=''
                              list-type="picture"
                              :on-change='changeUpload'
                            >
                              <el-button
                                slot="trigger"
                                size="mini"
                                type="primary"
                              >选取图片
                              </el-button>
                              <span>&nbsp;</span>

                            </el-upload>
                          </div>
                          <el-table
                            :data="filePICList"
                            style="width: 100%"
                            max-height="220"
                          >

                            <el-table-column
                              fixed="right"
                              label="图片"
                            >
                              <template slot-scope="scope">

                                <el-image
                                  style="width: 80px; height: 80px"
                                  :src="scope.row.FilePath"
                                  :fit="fill"
                                ></el-image>
                              </template>
                            </el-table-column>

                            <el-table-column
                              fixed="right"
                              label="操作"
                              width="180"
                            >
                              <template slot-scope="scope">
                                <el-button
                                  @click.native.prevent="deleteRowPIC(scope.$index, filePICList)"
                                  type="text"
                                  size="small"
                                >
                                  移除
                                </el-button>
                              </template>
                            </el-table-column>
                          </el-table>
                        </el-card>
                      </div>
                    </el-col>
                  </el-row>
                </div>
              </el-card>
            </div>
          </el-tab-pane>
          <el-tab-pane
            label="辅助检查"
            name="5"
          >
            <div class="cardP">
              <el-card class="box-card">
                <div
                  slot="header"
                  class="clearfix"
                >
                  <span>辅助检查</span>
                  <el-button
                    style="float: right; padding: 3px 0"
                    type="text"
                    v-if="false"
                  >操作按钮
                  </el-button>
                </div>
                <div
                  class="cardC"
                  style="height: 400px;overflow-y: auto"
                >
                  <el-row>
                    <el-col :span="24">
                      <div class="grid-content bg-purple ">
                        <el-card style="width: 100%">
                          <div
                            slot="header"
                            class="clearfix"
                          >
                            <span>会诊目的</span>
                          </div>
                          <div>
                            <el-input
                              type="textarea"
                              :rows="4"
                              placeholder="字数限制2000"
                              maxlength="2000"
                              show-word-limit
                              v-model="huizhenObj.Consult.Goal"
                            >
                            </el-input>
                          </div>

                        </el-card>
                      </div>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <div class="grid-content bg-purple ">
                        <el-card style="width: 100%">
                          <div
                            slot="header"
                            class="clearfix"
                          >
                            <span>补充说明</span>
                          </div>
                          <div>
                            <el-input
                              type="textarea"
                              :rows="4"
                              placeholder="字数限制1000"
                              maxlength="1000"
                              show-word-limit
                              v-model="huizhenObj.Consult.Describe"
                            >
                            </el-input>
                          </div>
                        </el-card>
                      </div>
                    </el-col>
                  </el-row>

                </div>
              </el-card>
            </div>
          </el-tab-pane>
        </el-tabs>
        <el-row style="margin-top: 16px">
          <el-col :span="12">
            <el-link disabled></el-link>
          </el-col>
          <el-col :span="12">
            <div class="grid-content bg-purple-light div_P">
              <el-button
                type="success"
                plain
                @click="nexMenu1()"
                v-if="activeName!='first'"
              >上一步</el-button>
              <el-button
                type="success"
                plain
                @click="nexMenu2()"
                v-if="activeName!='5'"
              >下一步</el-button>
              <el-button
                type="success"
                v-if="activeName=='5'"
                plain
                @click="addHZObj()"
              >保存</el-button>
            </div>
          </el-col>

        </el-row>
      </div>

      <!--弹框选择医生-->
      <div
        class="blackBg hyCZBg"
        v-if="isShow=='YSLB'"
      >
        <div class="panel-default column2">
          <em
            class="closes"
            @click="showDialog('')"
          >×</em>
          <div class="panel-heading">会诊医生</div>
          <div class="pucLabel">
            <div class="form-group clearfix">
              <p>
                <label>医院：</label>
                <select
                  class="form-control"
                  v-model="selectZZJGObj"
                  @change="getDeptListYS()"
                  placeholder="请选择"
                >
                  <option
                    v-for="(item,index) in zzjgList"
                    :label="item.HospitalName"
                    :value="item"
                    :key="index"
                  ></option>
                </select>
              </p>
              <p>
                <label>科室：</label>
                <select
                  class="form-control"
                  v-model="selectDeptYS"
                  @change="getUserList"
                  placeholder="请选择"
                >
                  <option
                    v-for="(item,index) in deptListYS"
                    :label="item.Name"
                    :value="item"
                    :key="index"
                  ></option>
                </select>
              </p>

            </div>
            <div class="fjtable">
              <el-table
                :data="userList"
                height="112"
                @row-dblclick="selectYSChange"
                border
                style="width: 100%"
              >
                <el-table-column
                  fixed
                  prop="HospitalId"
                  label="所属医院"
                >
                </el-table-column>
                <el-table-column
                  prop="name"
                  label="科室"
                >
                </el-table-column>
                <el-table-column
                  prop="UserName"
                  label="姓名"
                >
                </el-table-column>
                <el-table-column
                  prop="Title"
                  label="擅长"
                >
                </el-table-column>
                <el-table-column
                  prop="Describe"
                  label="简介"
                >
                </el-table-column>

              </el-table>
            </div>
          </div>
          <div class="modal-footer">
            <button
              type="button"
              class="btn btn-default"
              @click="showDialog('')"
            >关闭</button>
            <button
              type="button"
              class="btn btn-primary"
              @click="addJcbw()"
            >保存</button>
          </div>
        </div>
      </div>

      <!--弹框选择检查-->
      <div
        class="blackBg hyCZBg"
        v-if="isShow=='JCLB'"
      >
        <div class="panel-default column2">
          <em
            class="closes"
            @click="showDialog('')"
          >×</em>
          <div class="panel-heading">上传检查</div>
          <div class="pucLabel">
            <div class="form-group clearfix">
              <p>
                <label>科室：</label>
                <select
                  class="form-control"
                  v-model="selectDept"
                  placeholder="请选择"
                >
                  <option
                    v-for="(item,index) in deptList"
                    :label="item.Name"
                    :value="item"
                    :key="index"
                  ></option>
                </select>
              </p>
              <p>
                <label>患者姓名：</label>
                <input
                  type="text"
                  class="form-control"
                  v-model="name"
                />
              </p>
            </div>
            <div class="fjtable">
              <el-table
                :data="JCList"
                height="112"
                @row-dblclick="selectJCChange"
                border
                style="width: 100%"
              >
                <el-table-column
                  fixed
                  prop="StudyId"
                  label="检查号"
                  width="150"
                >
                </el-table-column>
                <el-table-column
                  prop="CheckTime"
                  label="检查时间"
                  width="120"
                >
                </el-table-column>
                <el-table-column
                  prop="Device"
                  label="设备名称"
                  width="120"
                >
                </el-table-column>
                <el-table-column
                  prop="Modality"
                  label="检查类型"
                  width="120"
                >
                </el-table-column>
                <el-table-column
                  prop="StudyDesc"
                  label="检查描述"
                  width="120"
                >
                </el-table-column>

              </el-table>
            </div>
          </div>
          <div class="modal-footer">
            <button
              type="button"
              class="btn btn-default"
              @click="showDialog('')"
            >关闭</button>
            <button
              type="button"
              class="btn btn-primary"
              @click="addJcbw()"
            >保存</button>
          </div>
        </div>
      </div>
      <!--弹框选择病理-->
      <div
        class="blackBg hyCZBg"
        v-if="isShow=='BLLB'"
      >
        <div class="panel-default column2">
          <em
            class="closes"
            @click="showDialog('')"
          >×</em>
          <div class="panel-heading">上传病理</div>
          <div class="pucLabel">
            <div class="form-group clearfix">
              <p>
                <label>科室：</label>
                <select
                  class="form-control"
                  v-model="selectDept"
                  placeholder="请选择"
                >
                  <option
                    v-for="(item,index) in deptList"
                    :label="item.Name"
                    :value="item"
                    :key="index"
                  ></option>
                </select>
              </p>
              <p>
                <label>患者姓名：</label>
                <input
                  type="text"
                  class="form-control"
                  v-model="name"
                />
              </p>
            </div>
            <div class="fjtable">
              <el-table
                :data="BLList"
                height="112"
                @row-dblclick="selectBLChange"
                border
                style="width: 100%"
              >
                <el-table-column
                  fixed
                  prop="StudyId"
                  label="检查编号"
                  width="120"
                >
                </el-table-column>
                <el-table-column
                  fixed
                  prop="CheckTime"
                  label="检查时间"
                  width="120"
                >
                </el-table-column>
                <el-table-column
                  fixed
                  prop="Device"
                  label="检查设备"
                  width="120"
                >
                </el-table-column>
                <el-table-column
                  fixed
                  prop="Modality"
                  label="检查类别"
                  width="120"
                >
                </el-table-column>

                <el-table-column
                  prop="StudyDesc"
                  label="检查说明"
                >
                </el-table-column>

              </el-table>
            </div>
          </div>
          <div class="modal-footer">
            <button
              type="button"
              class="btn btn-default"
              @click="showDialog('')"
            >关闭</button>
            <button
              type="button"
              class="btn btn-primary"
              @click="addJcbw()"
            >保存</button>
          </div>
        </div>
      </div>
      <!--弹框选择检验-->
      <div
        class="blackBg hyCZBg"
        v-if="isShow=='JYLB'"
      >
        <div class="panel-default column2">
          <em
            class="closes"
            @click="showDialog('')"
          >×</em>
          <div class="panel-heading">上传检验</div>
          <div class="pucLabel">
            <div class="form-group clearfix">
              <p>
                <label>科室：</label>
                <select
                  class="form-control"
                  v-model="selectDept"
                  placeholder="请选择"
                >
                  <option
                    v-for="(item,index) in deptList"
                    :label="item.Name"
                    :value="item"
                    :key="index"
                  ></option>
                </select>
              </p>
              <p>
                <label>患者姓名：</label>
                <input
                  type="text"
                  class="form-control"
                  v-model="name"
                />
              </p>
            </div>
            <div class="fjtable">
              <el-table
                :data="JYList"
                height="112"
                border
                @row-dblclick="selectJYChange"
                style="width: 100%"
              >
                <el-table-column
                  fixed
                  prop="TestId"
                  label="化验单编号"
                  width="150"
                >
                </el-table-column>
                <el-table-column
                  fixed
                  prop="ItemName"
                  label="结果项目名称"
                  width="150"
                >
                </el-table-column>
                <el-table-column
                  prop="TestTime"
                  label="化验时间"
                  width="120"
                >
                </el-table-column>
                <el-table-column
                  prop="Result"
                  label="数值"
                  width="80"
                >
                </el-table-column>
                <el-table-column
                  prop="Unit"
                  label="单位"
                  width="80"
                >
                </el-table-column>
                <el-table-column
                  prop="RRS"
                  label="参考范围"
                  width="120"
                >
                </el-table-column>

              </el-table>
            </div>
          </div>
          <div class="modal-footer">
            <button
              type="button"
              class="btn btn-default"
              @click="showDialog('')"
            >关闭</button>
            <button
              type="button"
              class="btn btn-primary"
              @click="addJcbw()"
            >保存</button>
          </div>
        </div>
      </div>
      <!--弹框选择心电-->
      <div
        class="blackBg hyCZBg"
        v-if="isShow=='XDLB'"
      >
        <div class="panel-default column2">
          <em
            class="closes"
            @click="showDialog('')"
          >×</em>
          <div class="panel-heading">上传心电</div>
          <div class="pucLabel">
            <div class="form-group clearfix">
              <p class="selectTime">
                <label style="width: 60px!important;">日期：</label>
                <el-date-picker
                  style="width:88px;height:32px"
                  type="date"
                  v-model="getThreeObj.bdate"
                  value-format="yyyy-MM-dd "
                  placeholder="选择日期"
                >
                </el-date-picker>
                -
                <el-date-picker
                  style="width:88px;height:32px"
                  type="date"
                  v-model="getThreeObj.edate"
                  value-format="yyyy-MM-dd "
                  placeholder="选择日期"
                >
                </el-date-picker>
              </p>
              <p>
                <label>患者姓名：</label>
                <input
                  type="text"
                  class="form-control"
                  style="width: 80px!important;"
                  v-model="name"
                />
                <button
                  type="button"
                  @click="getThreeDataList('ECG')"
                >查询</button>
              </p>
            </div>
            <div class="fjtable">
              <el-table
                :data="XDList"
                height="112"
                border
                @row-dblclick="selectXDChange"
                style="width: 100%"
              >
                <el-table-column
                  fixed
                  prop="StudyId"
                  label="检查编号"
                  width="120"
                >
                </el-table-column>
                <el-table-column
                  fixed
                  prop="Device"
                  label="检查设备"
                  width="120"
                >
                </el-table-column>
                <el-table-column
                  fixed
                  prop="Modality"
                  label="检查类别"
                  width="120"
                >
                </el-table-column>
                <el-table-column
                  prop="CheckTime"
                  label="检查时间"
                  width="120"
                >
                </el-table-column>
                <el-table-column
                  prop="StudyDesc"
                  label="检查说明"
                >
                </el-table-column>

              </el-table>
            </div>
          </div>
          <div class="modal-footer">
            <button
              type="button"
              class="btn btn-default"
              @click="showDialog('')"
            >关闭</button>
            <button
              type="button"
              class="btn btn-primary"
              @click="addJcbw()"
            >保存</button>
          </div>
        </div>
      </div>
      <!--            拍照弹框-->
      <div
        class="blackBg hyCZBg"
        v-if="isShow=='PZ'"
      >
        <div class="panel-default column2">
          <em
            class="closes"
            @click=" showDialog('')"
          >×</em>
          <div class="panel-heading">拍照</div>
          <div class="pucLabel">
            <div class="camera_outer">
              <video
                id="videoCamera"
                :width="videoWidth"
                :height="videoHeight"
                autoplay
              ></video>
              <canvas
                id="canvasCamera"
                :width="videoWidth"
                :height="videoHeight"
              ></canvas>
              <div
                v-if="imgSrc!=''"
                class="img_bg_camera"
              >
                <img
                  :src="imgSrc"
                  alt=""
                  class="tx_img"
                >
              </div>
              <button @click="getCompetence()">打开摄像头</button>
              <button @click="stopNavigator()">关闭摄像头</button>
              <button @click="setImage()">拍照</button>
            </div>
          </div>

          <div class="modal-footer">
            <button
              type="button"
              class="btn btn-default"
              @click="showDialog('')"
            >关闭</button>
            <button
              type="button"
              class="btn btn-primary"
              @click="okImage()"
            >保存</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "Bedinformation",
  data () {
    return {
      msg: "SystemManagement 下的 Bedinformation",
      activeName: 'first',
      hzfsList: [
        { name: '普通会诊', code: "01" },
        { name: '专家会诊', code: "02" },
        { name: '知名专家会诊', code: "03" },
        { name: '门诊', code: "04" },
      ],//会诊方式
      jjqkList: [
        { name: '是', code: "01" },
        { name: '否', code: "02" },
      ],//紧急情况
      sqlxList: [
        { name: '普通报告', code: "01" },
        { name: '疑难会诊', code: "02" },
      ],//紧急情况
      sfjhList: [
        { name: '是', code: "01" },
        { name: '否', code: "02" },
      ],//紧急情况
      hzsjList: [
        { name: '上午', code: "01" },
        { name: '下午', code: "02" },
      ],//会诊时间
      //年龄单位
      nldwList: [
        { name: '岁', code: "01" },
        { name: '月', code: "02" },
        { name: '天', code: "03" },
      ],//
      //性别
      xbList: [
        { name: '男', code: "01" },
        { name: '女', code: "02" },
        { name: '未知', code: "03" },
      ],
      //婚姻情况
      hyqkList: [
        { name: '未婚', code: "01" },
        { name: '已婚', code: "02" },
        { name: '离异', code: "03" },
      ],
      //患者病情
      hzbqList: [
        { name: '一般', code: "01" },
        { name: '紧急', code: "02" },
        { name: '病危', code: "03" },
      ],
      //医保类别
      yblbList: [
        { name: '自费', code: "01" },
        { name: '居民医保', code: "02" },
        { name: '职工医保', code: "03" },
      ],
      //就诊类型
      jzlxList: [
        { name: '门诊', code: "01" },
        { name: '住院', code: "02" },
      ],
      //国籍
      gjList: [
        { name: '中国', code: "01" },
        { name: '外籍', code: "02" },
      ],
      //民族
      mzList: [
        { name: '汉族', code: "01" },
        { name: '其他少数民族', code: "02" },
      ],
      //职业
      zyList: [
        { name: '自由职业', code: "01" },
        { name: '其他', code: "02" },
      ],
      radio: '1',
      textarea: '',
      isShow: "",

      /*************************远程会诊**********************************/
      //会诊实体
      huizhenObj: {
        //会诊对象实体
        Consult: {
          Id: 0,
          HospitalId: 0,
          DeptId: 0,
          DoctorId: 0,
          BigType: 0,
          ConType: 0,
          isEm: 0,
          ReqType: 0,
          isAc: 0,
          SubscribeTime: "2020-01-14T02:09:31.446Z",
          RealSubscribeTime: "2020-01-14T02:09:31.446Z",
          TimeFlag: 0,
          Goal: "",
          Describe: "",
          CreateTime: "2020-01-14T02:09:31.446Z",
          CreateId: 0,
          Status: 0,
          isDeleted: 0
        },
        //患者实体
        Consult_Patient: {
          Id: 0,
          ConsultId: 0,
          Catagory: 0,
          PatientId: 0,
          IDCard: 0,
          Name: "",
          Sex: 0,
          Age: 0,
          AgeUnit: 0,
          Marital: 0,
          Condition: 0,
          Weight: "",
          Height: "",
          BMI: "",
          Country: 0,
          Nation: 0,
          Born: "",
          MedicalCatagory: 0,
          MedicalCard: "",
          TelePhone: "",
          Occupation: "",
          Address: "",
          Dept: "",
          SeekCatagory: 0,
          InDate: "",
          OutDate: ""
        },
        //患者病历摘要
        Consult_Patient_Remark: {
          ConsultId: 0,
          ZhuSu: "",
          XianBingShi: "",
          JiWangShi: "",
          TiGeJianCha: "",
          FuZhuJianCha: "",
          ChuBuZhenDuan: "",
          ZhiLiaoJingGuo: "",
          ZhuanKeBingli: ""
        },
        //会诊医生实体集合
        Consult_Joins: [],
        //化验记录集合
        Consult_TestRecords: [],
        //病理检查记录集合
        Consult_PathologyRecords: [],
        //检查记录集合
        Consult_CheckRecords: [],
        //心电记录集合
        Consult_ECGRecords: [],
        //会诊附件集合
        Consult_Files: []
      },
      //会诊医生实体
      Consult_Join: {
        Id: 0,
        ConsultId: 0,
        DeptKind: 0,
        HospitalId: 0,
        DeptId: 0,
        DoctorId: 0,
        ConRoomId: 0,
        isCanWrite: 0,
        IsMaster: 0,
        joinTime: "2020-01-14T02:09:31.447Z",
        JoinId: 0
      },
      //化验记录实体
      Consult_TestRecord: {
        Id: 0,
        ConsultId: 0,
        PatientId: "string",
        TestId: "string",
        Title: "string",
        TestTime: "string",
        ItemCode: "string",
        ItemName: "string",
        Result: "string",
        Unit: "string",
        RRS: "string",
        ConsultSource: "string"
      },
      //病理检查实体
      Consult_PathologyRecord: {
        Id: 0,
        ConsultId: 0,
        PatientId: "string",
        StudyId: "string",
        Title: "string",
        CheckTime: "string",
        Device: "string",
        Modality: "string",
        StudyDesc: "string",
        ConsultSource: "string"
      },
      //检查记录实体
      Consult_CheckRecord: {
        Id: 0,
        ConsultId: 0,
        PatientId: "string",
        StudyId: "string",
        Title: "string",
        CheckTime: "string",
        Device: "string",
        Modality: "string",
        StudyDesc: "string",
        ConsultSource: "string"
      },
      //心电记录实体
      Consult_ECGRecord: {
        Id: 0,
        ConsultId: 0,
        PatientId: "string",
        StudyId: "string",
        Title: "string",
        CheckTime: "string",
        Device: "string",
        Modality: "string",
        StudyDesc: "string",
        ConsultSource: "string"
      },
      //会诊附件实体
      Consult_File: {
        Id: 0,
        ConsultId: 0,
        Code: "string",
        FilePath: "string",
        ImgType: 0
      },
      /****************************会诊相关字典**********************************/
      zzjgList: [],
      deptList: [],
      selectDept: {},
      LoginInfor: {},

      deptListYS: [],
      selectDeptYS: {},
      selectZZJGObj: {},
      userList: [],
      /****************图片附件************************/
      filePICList: [],
      fileList: [],
      imgSrcUrl: "",
      /**************************************拍照****************************************/
      videoWidth: 300,
      videoHeight: 300,
      imgSrc: '',
      thisCancas: null,
      thisContext: null,
      thisVideo: null,
      /******************************弹框测试数据**********************************/
      JCList: [],
      BLList: [],
      JYList: [],
      XDList: [],
      /********************************************/
      getThreeObj: {
        kind: "",//数据类别(PACS-检查 BL-病理 ECG-心电图 LIS-化验 US-超声检查)
        bdate: "",
        edate: "",
        patname: "",
      },
    };
  },
  methods: {
    nexMenu1 () {
      if (this.activeName == "first") {

      } else if (this.activeName == "second") {
        this.activeName = "first"
      } else if (this.activeName == "third") {
        this.activeName = "second"
      } else if (this.activeName == "fourth") {
        this.activeName = "third"
      } else if (this.activeName == "5") {
        this.activeName = "fourth"
      }
    },
    nexMenu2 () {
      if (this.activeName == "first") {
        this.activeName = "second"
      } else if (this.activeName == "second") {
        this.activeName = "third"
      } else if (this.activeName == "third") {
        this.activeName = "fourth"
      } else if (this.activeName == "fourth") {
        this.activeName = "5"
      } else if (this.activeName == "5") {

      }
    },
    handleClick (tab, event) {
      console.log(tab, event);
    },

    showDialog (show) {
      this.isShow = show;
    },
    getDeptList () {

      var params = {
        HospitalId: this.LoginInfor.HospitalId,
        name: ""
      };
      this.$get("Dept/GetList", params)
        .then(res => {
          this.deptList = res.data;
          console.log("科室列表查询结果");
          console.log(res);
        })
        .catch(err => {
          console.log(err);
        });
    },
    getZZJGList () {
      this.zzjgList = [];
      var params = {
        name: ""
      };
      this.$get("Hospital/GetList", params)
        .then(res => {
          //this.total = res.data.totalCount;//
          this.zzjgList = res.data;
          if (this.zzjgList.length > 0) {
            this.selectZZJGObj = this.zzjgList[0];
            this.getDeptListYS();
          }
          console.log("组织机构列表查询结果");
          console.log(res);
        })
        .catch(err => {
          console.log(err);
        });
    },
    getDeptListYS () {
      //
      var params = {
        HospitalId: this.selectZZJGObj.HospitalId,
        name: ""
      };
      this.$get("Dept/GetList", params)
        .then(res => {
          this.deptListYS = res.data;
          console.log("科室列表查询结果");
          console.log(res);
        })
        .catch(err => {
          console.log(err);
        });
    },
    getUserList () {
      this.userList = [];

      if (this.selectZZJGObj == null) {
        this.$message({
          showClose: true,
          message: "请选择操作机构！",
          type: "error"
        });
        return;
      }
      var params = {
        HospitalId: this.selectZZJGObj.HospitalId,
        SectionId: this.selectDeptYS.Id
      };
      this.$get("User/GetListBySection", params)
        .then(res => {
          this.userList = res.data;
          console.log("用户列表查询结果");
          console.log(res);
        })
        .catch(err => {
          console.log(err);
        });
    },
    /****************************************远程会诊弹框选中监听***********************************************************/

    selectYSChange (val, column, event) {
      console.log("选中会诊医生数据");
      console.log(val)
      var Consult_Join = {
        Id: -1,
        ConsultId: -1,
        DeptKind: 0,
        HospitalId: val.HospitalId,
        DeptId: this.selectDeptYS.Id,
        DoctorId: val.UserId,
        UserName: val.UserName,
        Title: val.Title,
        Describe: val.Describe,
        ConRoomId: -1,
        isCanWrite: 0,
        IsMaster: 0,
        joinTime: "2020-01-14T02:09:31.447Z",
        JoinId: 0
      }

      this.huizhenObj.Consult_Joins.push(Consult_Join)
      this.showDialog('')
    },
    handleClickYSItem (row) {
      console.log("查看医生操作");
      console.log(row);
    },
    updateRow2YS (index, rows) {
      console.log("是否主诊");
      console.log(index);
      var rowItem = rows[index];
      rows.forEach(m => {
        if (m.DoctorId == rowItem.DoctorId) {
          if (m.IsMaster == 0) {
            m.IsMaster = 1;
          } else {
            m.IsMaster = 0;
          }
        } else {
          m.IsMaster = 0;
        }

      })

    },
    deleteRow2YS (index, rows) {
      console.log("删除医生操作");
      console.log(index);
      rows.splice(index, 1);
    },


    selectJCChange (val, column, event) {
      console.log("选中检查数据");
      console.log(val)
      this.huizhenObj.Consult_CheckRecords.push(val)
      this.showDialog('')
    },

    deleteRow2JC (index, rows) {
      console.log("删除检查操作");
      console.log(index);
      rows.splice(index, 1);
    },
    //病理检查
    selectBLChange (val, column, event) {
      console.log("选中病理数据");
      console.log(val)
      this.huizhenObj.Consult_PathologyRecords.push(val)
      this.showDialog('')
    },

    deleteRow2BL (index, rows) {
      console.log("删除病理操作");
      console.log(index);
      rows.splice(index, 1);
    },
    //检验结果
    selectJYChange (val, column, event) {
      console.log("选中检验数据");
      console.log(val)
      this.huizhenObj.Consult_TestRecords.push(val)
      this.showDialog('')
    },
    handleClickJYItem (row) {
      console.log("查看检验操作");
      console.log(row);
    },
    deleteRow2JY (index, rows) {
      console.log("删除检验操作");
      console.log(index);
      rows.splice(index, 1);
    },
    //心电结果
    selectXDChange (val, column, event) {
      console.log("选中心电数据");
      console.log(val)
      this.huizhenObj.Consult_ECGRecords.push(val)
      this.showDialog('')
    },

    deleteRow2XD (index, rows) {
      console.log("删除心电操作");
      console.log(index);
      rows.splice(index, 1);
    },
    handleClickJCItem (row) {
      console.log("查看检查操作");
      console.log(row);
      this.$scanOpenJC("PACS", row.StudyId, this.getMsg)
    },
    handleClickBLItem (row) {
      console.log("查看病理操作");
      console.log(row);
      this.$scanOpenJC("US", row.StudyId, this.getMsg)
    },
    handleClickXDItem (row) {
      console.log("查看心电操作");
      console.log(row);
      this.$scanOpenJC("ECG", row.StudyId, this.getMsg)
    },
    /***********获取第三方检查检验数据**************/
    getThreeDataList (kind) {
      this.JCList = [];
      this.BLList = [];
      this.JYList = [];
      this.XDList = [];
      this.getThreeObj.kind = kind;
      var params = {
        kind: this.getThreeObj.kind,
        bdate: this.getThreeObj.bdate,
        edate: this.getThreeObj.edate,
        patname: this.getThreeObj.patname,
      };
      //GET /api/ThreeDataBuss/GetList
      this.$get("ThreeDataBuss/GetList", params)
        .then(res => {
          console.log("检查检验查询结果");
          console.log(res);
          if (res.data != null && res.data.length > 0) {
            console.log("检查检验")
            console.log(res.data[0].Table);
            if (kind == "PACS") {//数据类别(PACS-检查 BL-病理 ECG-心电图 LIS-化验 US-超声检查)
              this.JCList = res.data[0].Table;
            } else if (kind == "BL") {
              this.BLList = res.data[0].Table;
            } else if (kind == "LIS") {
              this.JYList = res.data[0].Table;
            } else if (kind == "ECG") {
              this.XDList = res.data[0].Table;
            }
          }

        })
        .catch(err => {
          console.log(err);
        });
    },
    /***************************************************************************/
    addHZObj () {
      // this.uploadFiles();
      setTimeout(() => {
        this.addHZObj2()
      }, 1000);
    },
    addHZObj2 () {
      // setTimeout(() => {
      //     this.uploadFiles()
      // }, 3000);

      for (var i = 0; i < this.filePICList.length; i++) {
        this.filePICList[i].FilePath = this.filePICList[i].FilePath.toString().substr(this.filePICList[i].FilePath.toString().indexOf(',') + 1);
      }
      this.huizhenObj.Consult_Files = this.filePICList;

      var params = this.huizhenObj;
      console.log("添加会诊实体");
      console.log(params);
      //POST /api/ConsultBuss/Create
      this.$post("ConsultBuss/Create", params)
        .then(res => {
          console.log("添加会诊结果");
          console.log(res);
          if (res.code == 0) {
            this.selectDeptYS = {};
            this.selectZZJGObj = {};
            this.huizhenObj = {
              //会诊对象实体
              Consult: {
                Id: 0,
                HospitalId: 0,
                DeptId: 0,
                DoctorId: 0,
                BigType: 0,
                ConType: 0,
                isEm: 0,
                ReqType: 0,
                isAc: 0,
                SubscribeTime: "2020-01-14T02:09:31.446Z",
                RealSubscribeTime: "2020-01-14T02:09:31.446Z",
                TimeFlag: 0,
                Goal: "",
                Describe: "",
                CreateTime: "2020-01-14T02:09:31.446Z",
                CreateId: 0,
                Status: 0,
                isDeleted: 0
              },
              //患者实体
              Consult_Patient: {
                Id: 0,
                ConsultId: 0,
                Catagory: 0,
                PatientId: 0,
                IDCard: 0,
                Name: "",
                Sex: 0,
                Age: 0,
                AgeUnit: 0,
                Marital: 0,
                Condition: 0,
                Weight: "",
                Height: "",
                BMI: "",
                Country: 0,
                Nation: 0,
                Born: "",
                MedicalCatagory: 0,
                MedicalCard: "",
                TelePhone: "",
                Occupation: "",
                Address: "",
                Dept: "",
                SeekCatagory: 0,
                InDate: "",
                OutDate: ""
              },
              //患者病历摘要
              Consult_Patient_Remark: {
                ConsultId: 0,
                ZhuSu: "",
                XianBingShi: "",
                JiWangShi: "",
                TiGeJianCha: "",
                FuZhuJianCha: "",
                ChuBuZhenDuan: "",
                ZhiLiaoJingGuo: "",
                ZhuanKeBingli: ""
              },
              //会诊医生实体集合
              Consult_Joins: [],
              //化验记录集合
              Consult_TestRecords: [],
              //病理检查记录集合
              Consult_PathologyRecords: [],
              //检查记录集合
              Consult_CheckRecords: [],
              //心电记录集合
              Consult_ECGRecords: [],
              //会诊附件集合
              Consult_Files: []
            };
          } else {
            this.$message({
              showClose: true,
              message: "会诊创建失败！",
              type: "error"
            });
          }
        })
        .catch(err => {
          console.log(err);
        });

    },
    /*****************附件上传*******************/
    changeUpload (file, fileList) {
      console.log("选择照片改变时")
      console.log(file)
      console.log(fileList)
      var That = this;
      var imgFile;
      var reader = new FileReader();     //html5读文件
      reader.readAsDataURL(file.raw); //转BASE64
      reader.onload = function (e) {        //读取完毕后调用接口
        imgFile = e.target.result;
        console.log("Base64图片：");
        console.log(imgFile);
        var Consult_File = {
          Id: 0,
          ConsultId: 0,
          Code: "string",
          FilePath: imgFile,
          ImgType: 0
        }
        That.filePICList.push(Consult_File);
      };
    },
    deleteRowPIC (index, rows) {
      rows.splice(index, 1);
    },
    /**********************************拍照****************************/
    // 调用权限（打开摄像头功能）
    getCompetence () {
      var _this = this
      this.thisCancas = document.getElementById('canvasCamera')
      this.thisContext = this.thisCancas.getContext('2d')
      this.thisVideo = document.getElementById('videoCamera')
      // 旧版本浏览器可能根本不支持mediaDevices，我们首先设置一个空对象
      if (navigator.mediaDevices === undefined) {
        navigator.mediaDevices = {}
      }
      // 一些浏览器实现了部分mediaDevices，我们不能只分配一个对象
      // 使用getUserMedia，因为它会覆盖现有的属性。
      // 这里，如果缺少getUserMedia属性，就添加它。
      if (navigator.mediaDevices.getUserMedia === undefined) {
        navigator.mediaDevices.getUserMedia = function (constraints) {
          // 首先获取现存的getUserMedia(如果存在)
          var getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.getUserMedia
          // 有些浏览器不支持，会返回错误信息
          // 保持接口一致
          if (!getUserMedia) {
            return Promise.reject(new Error('getUserMedia is not implemented in this browser'))
          }
          // 否则，使用Promise将调用包装到旧的navigator.getUserMedia
          return new Promise(function (resolve, reject) {
            getUserMedia.call(navigator, constraints, resolve, reject)
          })
        }
      }
      var constraints = {
        audio: false,
        video: { width: this.videoWidth, height: this.videoHeight, transform: 'scaleX(-1)' }
      }
      navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
        // 旧的浏览器可能没有srcObject
        if ('srcObject' in _this.thisVideo) {
          _this.thisVideo.srcObject = stream
        } else {
          // 避免在新的浏览器中使用它，因为它正在被弃用。
          _this.thisVideo.src = window.URL.createObjectURL(stream)
        }
        _this.thisVideo.onloadedmetadata = function (e) {
          _this.thisVideo.play()
        }
      }).catch(err => {
        console.log(err)
      })
    },
    //  绘制图片（拍照功能）
    setImage () {
      var _this = this
      // 点击，canvas画图
      _this.thisContext.drawImage(_this.thisVideo, 0, 0, _this.videoWidth, _this.videoHeight)
      // 获取图片base64链接
      var image = this.thisCancas.toDataURL('image/png')
      _this.imgSrc = image
      this.$emit('refreshDataList', this.imgSrc)
      this.stopNavigator();
    },
    okImage () {
      console.log("拍照图片Base64")
      console.log(this.imgSrc);
      var filePIC = this.dataURLtoFile(this.imgSrc, "123");
      console.log("图片文件")
      console.log(filePIC);
      var Consult_File = {
        Id: 0,
        ConsultId: 0,
        Code: "string",
        FilePath: this.imgSrc,
        ImgType: 0
      }
      this.filePICList.push(Consult_File);

      this.imgSrc = "";
      this.showDialog('')
      // this.getCompetence();
    },
    // base64转文件
    dataURLtoFile (dataurl, filename) {
      var arr = dataurl.split(',')
      var mime = arr[0].match(/:(.*?);/)[1]
      var bstr = atob(arr[1])
      var n = bstr.length
      var u8arr = new Uint8Array(n)
      while (n--) {
        u8arr[n] = bstr.charCodeAt(n)
      }
      return new File([u8arr], filename, { type: mime })
    },
    // 关闭摄像头
    stopNavigator () {
      this.thisVideo.srcObject.getTracks()[0].stop()

    }
  },
  created () {
    if (this.$route.query.Token) {
      localStorage.setItem('Token', this.$route.query.Token)
    }
    var loginInfor = localStorage.getItem('LoginInfor');
    this.LoginInfor = JSON.parse(loginInfor);
    console.log("个人登录信息");
    console.log(this.LoginInfor);
    this.huizhenObj.Consult.HospitalId = this.LoginInfor.HospitalId
    this.huizhenObj.Consult.DeptId = this.LoginInfor.UserId
    this.huizhenObj.Consult.DoctorId = this.LoginInfor.UserId

    this.getDeptList();
    this.getZZJGList();
  }
};
</script>
<style lang="scss">
.Wardinformation {
  .selectTime {
    .el-input__icon {
      height: 100%;
      width: 25px;
      display: none;
      text-align: center;
      -webkit-transition: all 0.3s;
      transition: all 0.3s;
      line-height: 40px;
    }

    .input {
      width: 90px !important;
      height: 28px !important;
    }
  }

  .selectPic {
    ul {
      padding: 0;
      display: none;
    }
  }

  .camera_outer {
    position: relative;
    overflow: hidden;
    background: #0a1015;
    background-size: 100%;

    video,
    canvas,
    .tx_img {
      -moz-transform: scaleX(-1);
      -webkit-transform: scaleX(-1);
      -o-transform: scaleX(-1);
      transform: scaleX(-1);
    }

    .btn_camera {
      position: absolute;
      bottom: 4px;
      left: 0;
      right: 0;
      height: 50px;
      background-color: rgba(0, 0, 0, 0.3);
      line-height: 50px;
      text-align: center;
      color: #ffffff;
    }

    .bg_r_img {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      top: 0;
    }

    .img_bg_camera {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      top: 0;

      img {
        width: 100%;
        height: 100%;
      }

      .img_btn_camera {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 50px;
        line-height: 50px;
        text-align: center;
        background-color: rgba(0, 0, 0, 0.3);
        color: #ffffff;

        .loding_img {
          width: 50px;
          height: 50px;
        }
      }
    }
  }

  .div_P {
    .form-control {
      display: inline-block;
      width: 12rem;
      height: 32px;
      padding: 5px 12px;
      font-size: 14px;
      line-height: 1.42857143;
      color: #555;
      background-color: #fff;
      background-image: none;
      border: 1px solid #ccc;
      border-radius: 4px;
      -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
      box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
      -webkit-transition: border-color ease-in-out 0.15s,
        -webkit-box-shadow ease-in-out 0.15s;
      transition: border-color ease-in-out 0.15s,
        -webkit-box-shadow ease-in-out 0.15s;
      transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
      transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s,
        -webkit-box-shadow ease-in-out 0.15s;
    }

    .form-group {
      height: 45px;
      margin: 0;
      line-height: 32px;
      padding: 6px 15px 0 15px;
    }
  }

  .fjtable {
    .el-table {
      font-size: 10px !important;
    }
  }

  .cardP {
    .text {
      font-size: 14px;
    }

    .el-card__header {
      padding: 18px 20px;
      border-bottom: 1px solid #ebeef5;
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
      background-color: azure;
    }

    .item {
      margin-bottom: 18px;
    }

    .clearfix:before,
    .clearfix:after {
      display: table;
      content: "";
    }

    .clearfix:after {
      clear: both;
    }

    .box-card {
      width: 100%;
    }
  }

  .cardC {
    .text {
      font-size: 14px;
    }

    .el-card__header {
      padding: 10px 20px;
      border-bottom: 1px solid #ebeef5;
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
      background-color: white;
    }

    .el-card__body {
      padding: 8px;
    }

    .item {
      margin-bottom: 18px;
    }

    .clearfix:before,
    .clearfix:after {
      display: table;
      content: "";
    }

    .clearfix:after {
      clear: both;
    }

    .box-card {
      width: 100%;
    }
  }

  .el-tree-node.is-current > .el-tree-node__content {
    color: #fff;
    background: #155a00 !important;
  }

  .dRightMain {
    padding: 18px;
  }

  .custom-tree-node {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    padding-right: 8px;
  }

  .el-table {
    font-size: 14px !important;
  }

  .el-table thead {
    color: #303133;
  }

  .dRightMain .Tb {
    position: absolute;
    top: 91px;
    left: 240px;
    right: 15px;
    bottom: 0;
    border: 1px solid #ddd;
  }
}
</style>



